﻿using Dapper.Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Dapper.Test
{
    public class DbContext
    {
        public IDbConnection conn;

        public static string connString = "server=47.92.31.227;database=pacs;uid=pacs;pwd=pacs;";

        private static DbContext _instance;

        public static DbContext Instance
        {
            get
            {
                if(_instance == null)
                {
                    _instance = new DbContext();
                }
                return _instance;
            }

        }
        

        private  DbContext()
        {
            conn = new SqlConnection(connString);
        }

        public List<T> Query<T>(string query)
        {
            return  conn.Query<T>(query).ToList();

        }
    }
}
